﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProgressBarDemo
{
    public partial class Form1 : Form
    {
        bool isRunning = false;

        public Form1()
        {
            InitializeComponent();
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            foreach (ProgressBar p in new ProgressBar[] { progressBar2, progressBar3 })
                p.Value = p.Value == p.Maximum ? p.Minimum : p.Value + 1;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (isRunning) {
                isRunning = false;
                timer1.Stop(); }
            else {
                isRunning = true;
                timer1.Start(); }
        }

        private void Form1_Load(object sender, EventArgs e)
        {


        }
    }
}
